let f7 = null;
let popup = null;

class Popup {
  static init(app) {
    f7 = app;
  }

  static show(param, animate = true) {
    Popup.dismiss();
    popup = f7.popup.create(param).open(animate);
  }

  static create(param) {
    Popup.dismiss();
    popup = f7.popup.create(param);
    return popup;
  }

  static dismiss(animate = true) {
    let result = false;

    if (null != popup && popup.opened) {
      // popup.close(animate).destroy()
      popup.close(animate);
      popup = null;
      result = true;
    }

    return result;
  }
}

export default Popup;